package com.easy.common.enumbean;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;

public enum Gender {
    //男，女
    MALE("男"),FEMALE("女");


    @EnumValue
    private String value;

    private Gender(String value){
        this.value=value;

    }

    @JsonCreator
    public Gender convert(String val){
        switch(val){
            case "男":
                return MALE;
            case "女":
                return FEMALE;
            default:
                throw new RuntimeException("没有对应的枚举类型");
        }

    }

    public String valueof(){
        return this.value;
    }

    @Override
    public String toString() {
        return this.value;
    }
}
